const { Sequelize } = require('sequelize');

//连接数据库
const sequelize = new Sequelize('express_login', 'root', 'root', {
  host: 'localhost',
  dialect: 'mysql',
  logging: false, // 关闭sequelize日志输出
});

//测试连接
(async function () {
  try {
    await sequelize.authenticate();
    console.log('Connection has been established successfully.');
  } catch (error) {
    console.error('Unable to connect to the database:', error);
  }
})();

module.exports = sequelize;
